<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>let</title>
	</head>
	<body>
		
	<script>
		let d = 100;
		console.log(d);
		{
			let girl = 'xxx';
			function x() {
				console.log(girl);
			}
			x();
		}
		// 变量解构赋值
		const F4 = ['one','two','three'];
		let [a,b,c] = F4;
		console.log(a);
		console.log(b);
		console.log(c);
		const qq = {name:'chinaoly',age:11,s:function() { console.log('快还钱!'); }};
		console.log(qq.name);
		console.log(`name is ${qq.name},age is ${qq.age}`);
		// 箭头函数 this 是静态的,始终指向函数声明时所在的作用域下的this值
		function getName() { console.log(this.name); }
		let getName2 = () => { console.log(this.name); };
		window.name = 'ooo';
		const SC = {name:'xxx'};
		getName();
		getName2();
		getName.call(SC);
		getName2.call(SC);
		// 不能作为构造实例化对象
		let Person = (name,age) => {
			this.name = name;
			this.age = age;
		}
		// let me = new Person('x',34);
		// console.log(me);
		// 不能使用arguments变量
		// let fn = () => {
		// 	console.log(arguments);
		// }
		//fn(12,3,4);
		// 箭头函数的简写
		// (1) 省略小括号,当形参有且只有一个的时候
		let add = n => { return n + 10;}
		console.log(add(5));
		// 省略花括号,当代码体只有一条语句的时候,此时return必须省略
		let pow = n => n * n;
		console.log(pow(6));
	</script>
	</body>
</html>